Skip to content

Fix: Fix expanding project from the ui by adding new features#114

Open
ipodishima wants to merge 2 commits intoAutoForgeAI:masterfrom
ipodishima:fix/feature_ui_mode
Open

Fix: Fix expanding project from the ui by adding new features#114
ipodishima wants to merge 2 commits intoAutoForgeAI:masterfrom
ipodishima:fix/feature_ui_mode

Conversation

@ipodishima
Copy link
Contributor

@ipodishima ipodishima commented Jan 27, 2026

The add new features from the UI sparkle icon wasn't working due to lack of permissions

Summary by CodeRabbit

  • New Features

    • Integrated an external feature-creation service to support bulk feature creation.
  • Improvements

    • Added an XML fallback format to ensure bulk feature creation succeeds when the primary service is unavailable.
    • Improved runtime tracking, logging, and session initialization for clearer visibility into feature-creation progress and outcomes.
  • Behavior

    • Prevents duplicate creations by preferring the service path and using XML only as a fallback.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

Adds MCP (Feature MCP) integration to run feature_create_bulk via Claude SDK, tracks MCP tool results to emit features_created events, and retains an XML <features_to_create> fallback parsed only when MCP creation does not succeed.

Changes

Cohort / File(s) Summary
Feature Creation Docs
.claude/commands/expand-project.md
Adds XML fallback backup format (<features_to_create>) for bulk feature creation mirroring required fields (category, name, description, steps) for automatic parsing when primary tool is unavailable.
MCP Integration & Session Flow
server/services/expand_chat_session.py
Adds MCP server config injection into ClaudeAgentOptions, extends allowed_tools to include MCP feature tools, introduces mcp_tool_succeeded tracking, parses ToolResult responses to extract created feature IDs and emit features_created events with source "mcp", and preserves XML parsing fallback used only when MCP does not succeed.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Claude SDK Client
    participant MCP as MCP Server
    participant Service as expand_chat_session
    participant Parser as XML Parser
    participant Features as Feature Service

    Client->>MCP: invoke feature_create_bulk tool
    alt MCP returns successful ToolResult
        MCP-->>Client: ToolResult (created IDs)
        Client->>Service: yield ToolResult block
        Service->>Service: mark mcp_tool_succeeded = true
        Service->>Features: record feature IDs & counts
        Service-->>Client: emit features_created (source: "mcp")
    else MCP fails or unavailable
        MCP-->>Client: failure/unavailable
        Client->>Service: continue processing (mcp_tool_succeeded = false)
        Service->>Parser: find <features_to_create> XML block
        Parser-->>Service: extracted feature objects
        Service->>Features: call _create_features_bulk
        Service-->>Client: emit features_created (source: "xml_parsing")
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped in with a clever scheme,
Sent features to the MCP stream,
If tools balk, XML will gleam,
IDs collected, events redeem —
A rabbit's leap to make builds beam.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title mentions 'Fix expanding project from the ui by adding new features' which aligns with the PR objectives that state the issue was the 'add new features' action from the UI not functioning, and the PR fixes this behavior.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@server/services/expand_chat_session.py`:
- Around line 346-375: The code that processes MCP tool results assumes every
dict in created_features has an "id" key, which can raise an uncaught KeyError;
update the handling in the ToolResult branch (the block that builds
created_features, self.features_created, and self.created_feature_ids) to safely
extract ids (e.g., use f.get("id") or filter only items where "id" in f), only
extend self.created_feature_ids with valid ids, and adjust the increment to
reflect the number of successfully extracted ids; additionally either broaden
the except clause to include KeyError or validate before accessing keys so no
KeyError is thrown (refer to variables created_features, self.features_created,
self.created_feature_ids and the ToolResult parsing block to locate the change).

getworken pushed a commit to getworken/autocoder that referenced this pull request Jan 27, 2026
…/autocoder

PR AutoForgeAI#114 - Fix: Fix expanding project from UI by adding new features
- Added MCP tool success detection to skip XML fallback when tool succeeds
- Added more Feature MCP tools to allowed list
- Added XML fallback documentation in expand-project.md

PR AutoForgeAI#115 - Fix latest build issues from master
- Added npm dependency staleness check in start_ui.py
- Added 'types': ['node'] to tsconfig.node.json
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@server/services/expand_chat_session.py`:
- Around line 346-379: The ToolResult detection is wrong: replace the type check
string "ToolResult" with "ToolResultBlock" and stop reading a non-existent
tool_name on the result block; instead use block.tool_use_id to find the
corresponding ToolUseBlock (the previously tracked ToolUseBlock that stores the
tool's name, e.g., where you recorded tool calls) and compare that
ToolUseBlock.name to "feature_create_bulk". Update the branch that currently
uses getattr(block, "tool_name", "") to look up the ToolUseBlock by tool_use_id,
set mcp_tool_succeeded when the matched ToolUseBlock.name contains
"feature_create_bulk", and then proceed to parse block.content as before while
still updating self.features_created, self.created_feature_ids and logging with
self.project_name.
🧹 Nitpick comments (1)
server/services/expand_chat_session.py (1)

408-426: Consider adding the same "id" safety filter for consistency.

Line 415 uses [f["id"] for f in created] without the safety filter applied in the MCP path (line 364). While _create_features_bulk guarantees "id" keys in returned dicts, adding the same defensive filter would improve consistency and protect against future changes.

♻️ Suggested fix for defensive consistency
                     if created:
-                        self.features_created += len(created)
-                        self.created_feature_ids.extend([f["id"] for f in created])
+                        valid_ids = [f["id"] for f in created if "id" in f]
+                        self.features_created += len(valid_ids)
+                        self.created_feature_ids.extend(valid_ids)

rudiheydra added a commit to rudiheydra/AutoBuildr that referenced this pull request Jan 28, 2026
…ure AutoForgeAI#114

- Verified TestStep8HarnessKernelExecution class with 3 test methods
- All 3 tests pass: kernel creates run, budget tracker tracks turns, kernel records started event
- Marked feature AutoForgeAI#114 as passing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
getworken pushed a commit to getworken/autocoder that referenced this pull request Jan 29, 2026
…/autocoder

PR AutoForgeAI#114 - Fix: Fix expanding project from UI by adding new features
- Added MCP tool success detection to skip XML fallback when tool succeeds
- Added more Feature MCP tools to allowed list
- Added XML fallback documentation in expand-project.md

PR AutoForgeAI#115 - Fix latest build issues from master
- Added npm dependency staleness check in start_ui.py
- Added 'types': ['node'] to tsconfig.node.json
@ipodishima
Copy link
Contributor Author

ipodishima commented Jan 29, 2026

This might be already merged right @leonvanzyl?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant